home *** CD-ROM | disk | FTP | other *** search
/ Developer Helper 1: Phil & Dave's Excellent CD / Excellent CD HFS.raw / Moof / Goodies / MPW Goodies / MPW Goodies⁄DTS / Lookup < prev    next >
Text File  |  2022-08-05  |  1KB  |  48 lines

  1. #    Lookup - open file using standard file
  2. #
  3. #    Usage:
  4. #        Lookup [-w] [directory]
  5. #
  6. #    Lookup opens a file that the user selects using standard file.
  7. #    The optional directory parameter specifies the initial directory
  8. #    displayed in the standard file dialog. The default directory
  9. #    is saved and restored, so that the next time standard file is
  10. #    used it will refer to the original default directory.
  11. #
  12. #    Addmenu can to used to provide menu items for opening files
  13. #    in specific directories.  For example:
  14. #
  15. #        AddMenu Lookup '{AIncludes}' ∂
  16. #            'Lookup "{AIncludes}" > Dev:Null ≥ Dev:Null'
  17. #
  18. #
  19. #    Copyright Apple Computer, Inc. 1988
  20. #    All rights reserved.
  21.  
  22. Set Exit 0                                    # don't exit early
  23.  
  24. Set RdWrPerm  "-r"                            # by default open READ-ONLY
  25. Set Directory :                                # default value for directory
  26. Set Directory `Directory` ∑Dev:Null            # save the directory
  27.  
  28. GetKeys O                                    # If option key, use RdWrPerm
  29. If {Status}
  30.     Set RdWrPerm  ""
  31. End
  32.  
  33. If "{1}" == "-w"                            # is it readwrite parameter
  34.     Set RdWrPerm  ""                        
  35.     If "{2}" ≠ ""
  36.         Directory "{2}"                        #    set the directory
  37.     End
  38. Else If "{1}" ≠ ""                            # if a parameter was specified
  39.     Directory "{1}"                            #    set the directory
  40. End
  41.  
  42. Open {RdWrPerm} ∑Dev:Null                    # open the file
  43. Set OpenStatus {Status}                        # remember the status
  44.  
  45. Directory "{Directory}"                        # restore the original directory
  46.  
  47. Exit {OpenStatus}                            # exit with status from Open
  48.